function callServer(strURL,id){
	var result = false;
	var xmlHttp = getXMLHttpRequest();
	
	xmlHttp.open('GET', strURL, true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState == 4){
			result = updatepage(xmlHttp.responseText,id);
		}
	}
	xmlHttp.send(null);
	return result;
}
function updatepage(content, id){
	if(id == null) {
		return content;
	}
	document.getElementById(id).innerHTML = content;
	return true;
}

function postServer(strURL,val,id) {
	var result = false;
	var xmlHttp = getXMLHttpRequest();
	xmlHttp.open('POST', strURL, true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState == 4){
			result = updatepage(xmlHttp.responseText,id);
		}
	}
	xmlHttp.send(val);
	return result;
}

function getXMLHttpRequest(){
	var xmlHttp;
	if(window.XMLHttpRequest){ 
		var xmlHttp = new XMLHttpRequest();
	}else if(window.ActiveXObject){ 
		var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xmlHttp;
}

function getCookie(name, unesc){
	var result = null;
	var myCookie = " " + document.cookie + ";";
	var searchName = " " + name + "=";
	var startOfCookie = myCookie.indexOf(searchName);
	var endOfCookie;
	
	if (startOfCookie != -1){
	  startOfCookie += searchName.length;
	  endOfCookie = myCookie.indexOf(";",startOfCookie);
	  result = unescape(myCookie.substring(startOfCookie,endOfCookie));
	}
	return result;
}

function setCookie(name,value,expires,path,domain,secure){
	var date=new Date();
	date.setTime(date.getTime()+expires);
	var expString  = ((expires == null) ? "" : ("; expires=" + date.toGMTString()));
	var pathString  = ((path == null) ? "" : ("; path=" + path));
	var domainString = ((domain == null) ? "" : ("; domain=" + domain));
	var secureString = ((secure == true) ? "; secure" : "");
	document.cookie = name + "=" + escape(value) + expString + pathString + domainString + secureString;
}

function deleteCookie(name){
	var date=new Date();
	date.setTime(date.getTime()-10000);
	document.cookie=name+"="+null+"; expire="+date.toGMTString();
}
